package streams;

import java.io.*;

public class SerializeDemo {
	public static void main(String[] args) {
		Employee e = new Employee();
		e.name = "Alejandro More";
		e.address = "alejandromore@gmail.com";
		e.dni = 43410464;
		try {
			FileOutputStream fileOut = new FileOutputStream("employee.dat");
			ObjectOutputStream out = new ObjectOutputStream(fileOut);
			out.writeObject(e);
			out.close();
			fileOut.close();
			System.out.printf("Serialized data is saved in employee.dat");
		} catch (IOException i) {
			i.printStackTrace();
		}
	}
}